# auth.py
from flask import Blueprint, request, jsonify

auth_bp = Blueprint('auth', __name__)

@auth_bp.route('/login', methods=['POST'])
def login():
    data = request.json
    username = data.get('username')
    password = data.get('password')
    # 在这里进行用户名和密码的验证
    if username == 'admin' and password == 'admin':  # 仅为示例
        return jsonify({'message': '登录成功！'}), 200
    return jsonify({'message': '用户名或密码错误'}), 401

@auth_bp.route('/register', methods=['POST'])
def register():
    data = request.json
    username = data.get('username')
    password = data.get('password')
    # 在这里进行注册逻辑处理
    return jsonify({'message': '注册成功！'}), 200
